

<?php 
//$o_PoRecepcionBN = $a_Maestros['o_PoRecepcionBN'];

$contextMenu[0]["link"]      = "javascript:fn_nuevo()";
$contextMenu[0]["linkIcon"]  = "application_add.png";
$contextMenu[0]["linkTitle"] = "Nueva Transferencia";

$contextMenu[1]["link"]      = "javascript:listarTransferencias()";
$contextMenu[1]["linkIcon"]  = "application_view_list.png";
$contextMenu[1]["linkTitle"] = "Lista";

?>

<style>
.error {color: red;font-style: italic;}  
</style>

<div id="main">
    <?php include $_SERVER['DOCUMENT_ROOT'].'/gourmet-express/trunk/src/views/header.inc'; ?>
    <div id="zonaContenedor">
        <h3>:: Transferencia de Mercaderia</h3>
        <div id="module">
                <div>
                    
            <form id="form_nuevo" action="javascript:fn_guardar();">
                    <table width="100%">
                        <tr>
                            <td id="keyLabel" width="20%">Transferencia Nro</td>
                            <td width="30">Nuevo</td>
                            <td id="label" width="20%">Status</td>
                            <td>    
                                <input name="statusDsc" id='statusDsc' type="text" size="15" value="" disabled>  
                                <!--
                                <select name="s_Estado" id="s_Estado" class="required">
                                    <option value="">-- seleccione --</option><?php
                                    foreach ($a_TransEsta as $key => $obj){?>
                                    <option value="<?php echo $obj->getValorId();?>"><?php echo $obj->getDescripcion();?></option><?php
                                    }?>
                                </select>
                                -->
                            </td>
                        </tr>
                        <tr>
                            <td id="label">Tipo</td>
                            <td>
                                <select name="s_TipoTransfer" id="s_TipoTransfer" class="required">
                                    <option value="">-- seleccione --</option><?php
                                    foreach ($a_TipoTransf as $key => $obj){?>
                                    <option value="<?php echo $obj->getValorId();?>"><?php echo $obj->getDescripcion();?></option><?php
                                    }?>
                                </select>
                            </td>
                            <td id="label">Doc Transferencia</td>
                            <td><input type="text" name="s_DocTransfer" id="s_DocTransfer" class="required" size="12" value=""/></td>
                        </tr>
                        <tr>
                            <td id="label">Almacen Origen</td>
                            <td>
                                <select name="s_AlmOrigenId" id="s_AlmOrigenId" class="required">
                                <option value="">-- seleccione --</option><?php
                                foreach ($ao_ImAlmacenBN as $key => $obj){?>
                                <option value="<?php echo $obj->getAlmacenId();?>"><?php echo $obj->getNombre();?></option><?php
                                }?>
                                </select>
                            </td>
                            <td id="label">Doc Referencia</td>
                            <td><input type="text" name="s_DocRef" id="fechaGuiaRem" size="12" value="" class="required" /></td>
                        </tr>                 
                        <tr>
                            <td id="label">Almacen Destino</td>
                            <td nowrap>
                            	<select name="s_AlmDestinoId" id="s_AlmDestinoId" class="required">
                                    <option value="">-- seleccione --</option><?php
                                    foreach ($ao_ImAlmacenBN as $key => $obj){?>
                                    <option value="<?php echo $obj->getAlmacenId();?>"><?php echo $obj->getNombre();?></option><?php
                                    }?>
                                </select>
                            </td>
                            <td id="label">&nbsp;</td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td id="label">Observaciones</td>
                            <td>
                            <textarea name="obs" cols="40" rows="2"></textarea></td>
                            <td id="label" valign="top">&nbsp;</td>
                            <td valign="top">&nbsp;</td>
                        </tr>        
                        <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        </tr>
                    </table>

                    <table width=100%>
                        <tr>
                            <td></td>
                            <td align=right>
                                <a href="javascript:add_TR_TbodyRecep();">Agregar detalle</a>
                            </td>
                        </tr>
                    </table>

                    <table width="100%" >
                        <tr>
                            <td colspan="4">
                                <table width="100%" cellspacing="1" id='tableNuevoRecep'>
                                    <thead>
                                        <tr bgcolor="#CCCCCC" >
                                            <td>Codigo</td>
                                            <td width="35%">Descripcion</td>
                                            <td>UM</td>
                                            <td>Cantidad</td>                                        
                                            <td></td>                                 
                                        </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>                                    															
                                </table>
                            </td>
                        </tr>
                    </table>
                    <table width="100%">
                        <tr>
                            <td width="90%" align="right"><input type="submit" name="guardar" value="Guardar"></td>
                            <td align="right"><input type="button" id="btn_cancelar"name="btn_cancelar" onclick="javascript: listarTransferencias()" value="Cancelar"></td>  						 
                        <tr>	
                    </table> 
                    <br>&nbsp;
                    <div id="moduleSectionDetalleAdd"> </div>   
                </div>
            </form>
        <div id="gridFase" style="top:237px"></div>
      </div>
    <div id="footer"></div>
    <div id="moduleSectionDetalleAddList"> </div>
</div>
            
            
            
            
<script>

var iCorrelativoRecep = 0;

add_TR_TbodyRecep = function ()
{
  
  iCorrelativoRecep = iCorrelativoRecep+1
  
  var id_ItemCode = "itemCode_"+iCorrelativoRecep;
  
  var sTr='';
	sTr+="<tr bgcolor='#FFFFFF'>";
	sTr+="<td ><input type='text' itemG='itemG' id='"+id_ItemCode+"' name='a_ItemId["+iCorrelativoRecep+"]' size='15' style='width: 100px;' class='loadF2 required' ></td>";
	sTr+="<td id='txtDesc' desc='desc'>&nbsp;</td>";
	sTr+="<td UoM='UoM'>&nbsp;</td>";
	sTr+="<td ><input type='text' cant='cant' name='a_Cant["+iCorrelativoRecep+"]' size='5' class='number required' style='text-align:right' ></td>";
    sTr+="<td align='right'><img border='0' style='cursor:pointer' title='Eliminar Registro' src='/gourmet-express/trunk/imgs/icons/delete_icon.png' onclick='delete_TR_TbodyRecep(this)'></td>"; 		
    sTr+="</tr>";
    
  $("#tableNuevoRecep tbody").append(sTr);
    
  loadAutocompleteItem(id_ItemCode);

}

delete_TR_TbodyRecep = function (obj)
{
 $(obj).parents('tr').first().remove();
 evalMontos(); 
}  

$("#form_nuevo").validate();
	

</script>
